// Hover State Animations
var ddmj=jQuery;
ddmj(document).ready(function(){
	// Sign in panel toggle
	ddmj("#signin_show").click(function(){
		ddmj("#signin_panel").slideToggle({duration: 800, easing: 'easeOutSine'});
	},
	function(){
		ddmj(this).find("span").stop().animate({right:'-70px'},{ queue: false, duration: 150, easing: 'easeInBack'});
	});
	// Video thumbnails Watch Now effect
	ddmj('.video_thumbnail').hover(function(){
		ddmj(this).find("span").stop().animate({right:'0px'},{ queue: false, duration: 300, easing: 'easeOutSine'});
	},
	function(){
		ddmj(this).find("span").stop().animate({right:'-70px'},{ queue: false, duration: 150, easing: 'easeInBack'});
	});
	// Thumbnail pictures in Browse album pages
	ddmj('.pictures_entry a').hover(function(){
		ddmj(this).find("img").stop().animate({opacity:'0.25'},{ queue: false, duration: 600, easing: 'easeOutSine'});
	},
	function(){
		ddmj(this).find("img").stop().animate({opacity:'1'},{ queue: false, duration: 400, easing: 'easeOutSine'});
	});
 });


// Menu navigation Dropmenu
ddmj(document).ready(function(){
	ddmj('.sub_menu').css("display","none");
	// Find and add class to the Li parent of Ul sub_menu
	ddmj(".sub_menu").parent('li').addClass("drop");
	ddmj(".drop").hover(function(){
			ddmj(this).find('.sub_menu').slideDown(100);
	},function(){
			ddmj(this).find('.sub_menu').slideUp(100);
	});
		ddmj(".sub_menu a").hover(function(){
		ddmj(this).find('span').stop().animate({marginLeft:'10px'},{queue:false, duration:125, easing: 'easeInCubic'})
	},function(){
		ddmj(this).find('span').stop().animate({marginLeft:'0px'},{queue:false, duration:250, easing: 'easeOutSine'})
	});
 });


// Animate the lists...
ddmj(document).ready(function(){
		ddmj("#sidebar li a").wrapInner("<span></span>");
		ddmj("#sidebar li a").hover(function(){
		ddmj(this).find('span').stop().animate({marginLeft:'10px'},{queue:false, duration:125, easing: 'easeInCubic'})
	},function(){
		ddmj(this).find('span').stop().animate({marginLeft:'0px'},{queue:false, duration:250, easing: 'easeOutSine'})
	});
});

// Share network
ddmj(document).ready(function(){
	// Display the sharing menu
	ddmj('.sharing ul').css("opacity", "0");
	ddmj('.sharing').hover(function(){
	ddmj('.sharing ul').css("display","block");
		ddmj(this).find("ul").stop().animate({opacity:'1'},{ queue: false, duration: 300});
	},
	function(){
		ddmj(this).find("ul").stop().animate({opacity:'0'},{ queue: false, duration: 90});
		ddmj('.sharing ul').delay(300).css("display","none");
	});
	// Display the names of the networks
	ddmj('.sharing ul span').css("opacity", "0");
	ddmj('.sharing li').hover(function(){
		ddmj(this).find("span").stop().animate({opacity:'1'},{ queue: false, duration: 150});
	},
	function(){
		ddmj(this).find("span").stop().animate({opacity:'0'},{ queue: false, duration: 150});
	});
 });



// Captcha system
ddmj(document).ready(function(){

			ddmj("#errorcaptcha").css({opacity: "0"});
ddmj("#check").keyup(function () {
		var rep = ddmj(this).val();
		var n1 = document.getElementById('num1').innerHTML;
		var n2 = document.getElementById('num2').innerHTML;
		var n3 = parseInt(n1) + parseInt(n2);
      		if( n3 == rep ){
			ddmj("#submitter").prepend('<input type="submit" name="contact_submit" id="contact_submit" value="Reply now" class="cufon" />').animate({opacity: "1"},{duration:350});
			ddmj("#errorcaptcha").text(" ").animate({opacity: "0"},{duration:150});
		}
		else {
			ddmj("#errorcaptcha").text("Not good!").animate({opacity: "1"},{duration:350});
			ddmj("#submitter").prepend('').animate({opacity: "0"},{duration:150}).empty();
		}
    });

 });